package com.yunduo.world;

import com.yunduo.world.config.NettyConfig;
import com.yunduo.world.utils.YBeanUtils;
import jakarta.annotation.Resource;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 启动类
 *
 * 启动服务器所必须包含的参数
 */
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class WorldApplication implements ApplicationRunner {
    @Resource
    private NettyConfig config;
    public static void main(String[] args){
        ConfigurableApplicationContext context = SpringApplication.run(WorldApplication.class, args);
        YBeanUtils.loadSpringContext(context);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        config.run();
    }
}
